﻿using System;
using Presenters.Inherited_Presenters;
using Interfaces.Delete_Interfaces;
using Model.Query_Model;
using Presenters.Managers;

namespace Presenters.Delete_Presenters
{
    public class RoadDeletePresenter:OperationStatus
    {
        private IRoadDeleteView view = null;
        public RoadOutput road = null;

        public RoadDeletePresenter(IRoadDeleteView view)
        {
            this.view = view;
        }

        public void Delete()
        {
            nameOperation = "Usuwanie wyceny";
            try
            {
                RoadManager manager = new RoadManager();
                manager.RoadDelete(road);
                view.ShowSuccess();
                view.Close();
            }
            catch (Exception ex)
            {
                exception = ex.Message;
                view.ShowError();
                view.Close();
            }
        }

        public void ExitApp()
        {
            view.Close();
        }
    }
}
